<extend name="Base:main" />
<block name="script">
  <link rel="stylesheet" href="__PUBLIC__/seller/css/validform.css" />
  <script src="__PUBLIC__/seller/js/Validform_v5.3.2.js"></script>
</block>
<block name="content">
<div class="tpl-content-wrapper">
  <div class="tpl-content-page-title"> 供应商订单列表 </div>
  <ol class="am-breadcrumb">
    <li><a href="#" class="am-icon-home">首页</a></li>
    <li><a href="#">订单管理</a></li>
    <li class="am-active">
      供货订单列表
    </li>
  </ol>
  <div class="tpl-portlet-components">
    <ul class="am-tabs-nav am-nav am-nav-tabs">
      <li 
      <eq name="Think.get.status" value="1">class="am-active"</eq>
      <empty name="Think.get.status" >class="am-active"</empty>
      ><a href="{:U('Order/supplyList')}">已发货订单 ({$yes_total})</a>
      </li>
      <li 
      <eq name="Think.get.status" value="2">class="am-active"</eq>
      ><a href="{:U('Order/supplyList',array('status' => 2))}">未发货订单 ({$no_total})</a>
      </li>
    </ul>
    <div class="tpl-block">
      <div class="am-g">
        <form class="am-form" action="{:U('Goods/index')}" method="get">
          <input type="hidden" name="c" value="{$Think.const.CONTROLLER_NAME}" class="form-control">
          <input type="hidden" name="a" value="{$Think.const.ACTION_NAME}" class="form-control">
          <input type="hidden" name="m" value="{$Think.const.MODULE_NAME}" class="form-control">
          <div class="am-u-sm-12 am-u-md-5">
            <label class=" am-form-label">订单编号</label>
            <span style="display: inline-block;">
            <input type="text"  name="keyword" value="{$sh.keyword}"  class=" am-form-field">
            </span>
            <label class=" am-form-label">&nbsp;&nbsp;&nbsp;订购人</label>
            <span style="display: inline-block;">
            <input type="text" name="sku" value="{$sh.sku}" class=" am-form-field">
            </span> </div>
          <div class="am-u-sm-12 am-u-md-3">
            <div class="am-input-group am-input-group-sm">
              <button type="submit" class="btn btn-purple btn-sm"> <span class="ace-icon fa fa-search icon-on-right bigger-110"></span> Search </button>
            </div>
          </div>
        </form>
      </div>
      <div class="am-g">
        <div class="am-u-sm-12">
          <table class="am-table am-table-striped am-table-hover table-main">
            <thead>
              <tr>
                <th class="center"><input class="check-all" type="checkbox" value=""></th>
                <th>订单编号</th>
                <th>分销商</th>
                <th>贸易模式</th>
                <th>购买人</th>
                <th>订单总额</th>
                <th>是否支付</th>
                <th>是否发货</th>
                <th>创建时间</th>
                <th class="table-set">操作</th>
              </tr>
            </thead>
            <tbody>
              <volist name="lists" id="val">
                <tr>
                  <td class="center"><input class="ids" type="checkbox" name="ids[]" value="{$val['id']}"></td>
                  <td><a href="{:U('supplyDetail',array('ref'=>$val['ref']))}">{$val['ref']}</a></td>
                  <td>{$val.shop_name}</td>
                  <td>{$val['trade_pattern']}</td>
                  <td>{$val['buyer_name']}</td>
                  <td>{:supplyOrderTotal($val['ref'] , $val['supply_customer_id'])}</td>
                  <td><?php if($val['pay_status']==0):?>
                    未支付
                    <?php else:?>
                    已支付
                    <?php endif;?></td>
                  <td ><?php if($val['express_name']):?>
                    已发货
                    <?php else:?>
                    未发货
                    <?php endif;?></td>
                  <td>{$val['create_time']}</td>
                  <td><div class="am-btn-toolbar">
                      <div class="am-btn-group am-btn-group-xs">
                        <button class="am-btn am-btn-default am-btn-xs am-text-secondary">
                        <span class="am-icon-pencil-square-o"></span> <a href="{:U('supplyDetail',array('ref'=>$val['ref']))}">订单详情</a>
                        </button>
                        <empty name="val.express_name">
                        <button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only" href="{:U('Order/delivery' , array('ref' => $val['ref']))}" width="600" height="455" menu="load_iframe_url" title="填写物流发货信息"><span class="am-icon-trash-o"></span> 发货</button>
                        </empty>
                      </div>
                    </div></td>
                </tr>
              </volist>
            </tbody>
          </table>
          <div class="am-cf">
            <div class="am-fr">
              <ul class="am-pagination tpl-pagination">
                {$data['page']}
              </ul>
            </div>
          </div>
          <hr>
        </div>
      </div>
    </div>
    <div class="tpl-alert"></div>
  </div>
</div>
<script>
	$(function () {
		var goods_type_id = $('#goods_type').val();
		if(goods_type_id){
			$('#goods_type_id option').each(function(){
				if( goods_type_id == $(this).attr('value') ) {
					$(this).attr('selected' , true);
					return false;
				} 
			}); 
		}
	});
	$(".check-all").click(function () {
		$(".ids").prop("checked", this.checked);
	});
	$(".ids").click(function () {
		var option = $(".ids");
		option.each(function (i) {
			if (!this.checked) {
				$(".check-all").prop("checked", false);
				return false;
			} else {
				$(".check-all").prop("checked", true);
			}
		});
	});
</script>
</block>
